/* main.c */

#include <stdio.h>

#include "board.h"
#include "pff.h"

FATFS app_fatfs;
uint8_t app_file_buff[32];
UINT   app_file_read_count;

int main(void)
{
    uint8_t ch;
    FRESULT res;

    board_init();

    printf("file system demo.\r\n");

    res = pf_mount(&app_fatfs);
    printf("pf_mount: %d\r\n", res);

    res = pf_open("1.txt");
    printf("pf_open: %d\r\n", res);

    res = pf_read(app_file_buff, 16u, &app_file_read_count);
    printf("pf_read: %d\r\n", res);
    for (uint32_t i = 0u; i < app_file_read_count; i++)
    {
        printf("%c", app_file_buff[i]);
    }
    printf("\r\n");

    while (1)
    {
        ch = getchar();
        putchar(ch);
    }
}
/* EOF. */

